﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinForm_Bankapp
{
    public class SavingsAccount : Account
    {
        public SavingsAccount(string accountNumber, decimal initialBalance)
            : base(accountNumber, initialBalance)
        {
        }

        public override void Withdraw(decimal amount)
        {
            if (amount <= 0)
            {
                throw new ArgumentException("Amount must be greater than zero.");
            }

            if (Balance >= amount)
            {
                Balance -= amount;
            }
            else
            {
                throw new InsufficientBalanceException("Insufficient balance.");
            }
        }

        public override void Deposit(decimal amount)
        {
            if (amount <=0)
            {
                throw new ArgumentException("Amount must be greater than zero");
            }
            else
            {
                Balance += amount;
            }
               
        }
    }
}
